﻿<Window x:Class="MediaPlayer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="KV Player developed by Karanveer Singh" SizeToContent="Width" ResizeMode="CanResize"
        MinWidth="350" MinHeight="100"
        Unloaded="Window_Unloaded"
        Name="main_window" 
        PreviewKeyDown="main_window_PreviewKeyDown"
        Topmost="false"
        Loaded="main_window_Loaded"
        Background="Transparent"
        Icon="MainIcon.png"
        MouseWheel="player_MouseWheel"
        >
    <Window.Resources>
        

        <ControlTemplate x:Key="ButtonTemplate" TargetType="{x:Type Button}">
            <Border CornerRadius="100" Name="template_border"  Background="Transparent" BorderThickness="0" BorderBrush="#0FF0F0F0">
                <ContentPresenter Margin="{TemplateBinding Padding}"  ></ContentPresenter>
            </Border>
           
        </ControlTemplate>
    </Window.Resources>
    <Grid ShowGridLines="False">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Menu Grid.Row="0"  Foreground="White" Name="main_menu" >
            <MenuItem Header="_Media" >
                <MenuItem Name="open"  Foreground="Black" Header="_Open" Click="Open_Click" InputGestureText="Ctrl+O" ></MenuItem>
                <Separator ></Separator>
                <MenuItem Name="Quit"  Foreground="Black" Header="_Quit" Click="Quit_Click" InputGestureText="Alt+F4 | Ctrl+Q" ></MenuItem>
                
            </MenuItem>
            <MenuItem Header="P_layback">
                <MenuItem Header="Play File" Foreground="Black" Name="Play" Click="Play_Click" InputGestureText="Ctrl+P">
                    
                </MenuItem>
                <MenuItem Header="Pause File" Foreground="Black" Name="Pause" Click="Play_Click" InputGestureText="Space"></MenuItem>
                <MenuItem Header="Stop File"  Foreground="Black" Name="Stop" Click="Stop_Click" InputGestureText="Ctrl+S"></MenuItem>
                
            </MenuItem>
            <MenuItem Header="_Audio">

                <MenuItem Header="Increase Volume"  Foreground="Black" Name="menu_IncAudio" Click="menu_IncAudio_Click"></MenuItem>
                <MenuItem Header="Decrease Volume" Foreground="Black"  Name="menu_DecAudio" Click="menu_DecAudio_Click"></MenuItem>
                <MenuItem Header="Mute" Foreground="Black"  IsChecked="False" Name="menu_mute" Click="menu_mute_Click"></MenuItem>
                   
                            </MenuItem>
        <!--    <MenuItem Header="_Video"></MenuItem>
            <MenuItem Header="_Tools"></MenuItem>
            <MenuItem Header="V_iew"></MenuItem> -->
            <MenuItem Header="Help">
                <MenuItem Header="About KV Player" Foreground="Black"  Name="menu_help_about" Click="menu_help_about_Click"></MenuItem>
            </MenuItem>
            <MenuItem Header="Subtitles">
                <MenuItem Header="Add Subtitle" Name="menu_subtitle_add" Foreground="Black"></MenuItem>
            </MenuItem>
            
            
        </Menu>
        <Grid Grid.Row="1" Background="Black" AllowDrop="True" Drop="media_player_SP_Drop" MouseMove="player_MouseMove" MouseLeftButtonDown="player_MouseLeftButtonDown" MouseWheel="player_MouseWheel" Name="media_player_SP">
            <Grid.ContextMenu >
                <ContextMenu Name="context">
                    <MenuItem Header="Play File"  Name="CPlay" Click="Play_Click">

                    </MenuItem>
                    <MenuItem Header="Pause File" Name="CPause" Click="Play_Click"></MenuItem>
                    <MenuItem Header="Stop File"  Name="CStop" Click="Stop_Click"></MenuItem>


                    <Separator></Separator>
                    <MenuItem Header="Quit" Name="CQuit" Click="Quit_Click"></MenuItem>


                </ContextMenu>
            </Grid.ContextMenu>
            <MediaElement Grid.Row="0" Grid.ZIndex="0" Stretch="Uniform"    MinHeight="{Binding ElementName=main_window,Path=Height,Mode=OneWay}"  Name="player" Height="{Binding ElementName=main_window,Mode=OneWay,Path=Height}"    MediaOpened="player_MediaOpened" MediaEnded="player_MediaEnded"  Focusable="True" >
                         
                        </MediaElement>
            <TextBlock Grid.ZIndex="1"  Background="Transparent" MaxHeight="70" VerticalAlignment="Bottom"  ></TextBlock>

        </Grid>
        
        <Grid Grid.Row="2" Name="timeline_grid">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition>


            </Grid.ColumnDefinitions>
        <Slider MaxHeight="30" MouseEnter="time_Slider_MouseEnter" IsMoveToPointEnabled="True" Grid.Column="0" Orientation="Horizontal" Minimum="0" Name="time_Slider" Background="Transparent"  ValueChanged="time_Slider_ValueChanged" IsSelectionRangeEnabled="true" SelectionStart="0" SelectionEnd="{Binding ElementName=player,Mode=OneWay,Path=Position}" HorizontalAlignment="Stretch" VerticalAlignment="Center" ></Slider>
            <TextBlock Foreground="White" Text="--:--" Background="Transparent" Name="timeline_textBox" Grid.Column="1" MinWidth="60" MinHeight="30" HorizontalAlignment="Left" VerticalAlignment="Center"> </TextBlock>
        </Grid>
        
        <Grid Grid.Row="3" ShowGridLines="False"  Name="ControlGrid" Background="#0c0c0c">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" ></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Column="1" Orientation="Horizontal">
                <Button  ToolTip="Play"  Grid.Column="1"   Template="{StaticResource ButtonTemplate}" Name="Button_Play" Click="Play_Click"  VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="10,0,10,10" MinWidth="50" MaxWidth="65" MinHeight="50" MaxHeight="65" VerticalContentAlignment="Center" HorizontalContentAlignment='Center'>
                    <Button.Content>
                        <Image Source="Play.png" Height="64" Width="64" ></Image>
                    </Button.Content>
                </Button>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <Button Grid.Column="0" ToolTip="Seek To Start"  Opacity=".85"  Name="Rewind" Click="Rewind_Click"  Template="{StaticResource ButtonTemplate}" HorizontalAlignment="Center" MinWidth="64" MaxWidth="64" MinHeight="64" MaxHeight="64" Margin="10" VerticalContentAlignment="Center" HorizontalContentAlignment='Center'>
                <Button.Content>
                        <Image Source="SeekStart.png"></Image>
                    </Button.Content>
            </Button>
                <Button Grid.Column="0" ToolTip="Stop" Opacity=".85" Name="Button_Stop" Click="Stop_Click"  Template="{StaticResource ButtonTemplate}" MinWidth="65" MaxWidth="65" MinHeight="65" MaxHeight="65" VerticalContentAlignment="Center" HorizontalContentAlignment='Center'>
                    <Button.Content>
                        <Image Source="Stop.png" Height="64" Width="64"></Image>
                    </Button.Content>
                </Button>
                <Button Grid.Column="0" ToolTip="Seek To End" Opacity=".85" Name="End" Click="End_Click"  Template="{StaticResource ButtonTemplate}" HorizontalAlignment="Center" MinWidth="64" MaxWidth="64" MinHeight="64" MaxHeight="64" Margin="10" VerticalContentAlignment="Center" HorizontalContentAlignment='Center'>
                    <Button.Content>
                        <Image Source="SeekEnd.png"></Image>
                    </Button.Content>
                </Button>
                

            </StackPanel>
            <StackPanel Grid.Column="2"  HorizontalAlignment="Right" Orientation="Vertical" Height="84" VerticalAlignment="Top">
                <StackPanel Orientation="Horizontal"></StackPanel>
                <StackPanel Orientation="Horizontal" Height="57">
                    <Label  Name="volume_label" Foreground="White" VerticalAlignment="Center"  MinWidth="50" MaxWidth="60" MinHeight="50" MaxHeight="60" HorizontalAlignment="Left" MouseLeftButtonDown="Label_MouseLeftButtonDown">
                        <Label.Content>
                            <Image Source="Volume.png" MinWidth="48" MaxWidth="48" MinHeight="48" MaxHeight="48" ></Image>
                        </Label.Content>
                    </Label>
                    <TextBox FontSize="16" IsReadOnly="True" Foreground="White" Background="Transparent" Width="50" VerticalAlignment="Center" Name="volume_TxtBlock" BorderBrush="Transparent" BorderThickness="0"></TextBox>
                    <Slider Margin="10" Name="volume_Slider" ValueChanged="volume_slider_ValueChanged" Background="Transparent" Orientation="Horizontal" Minimum="0" Maximum="1" IsSelectionRangeEnabled="True" Value="{Binding ElementName=player,Mode=TwoWay,Path=Volume}" MouseWheel="player_MouseWheel" Width="124" SelectionStart="0" SelectionEnd="{Binding ElementName=volume_Slider,Path=Value,Mode=OneWay}">
                    
                </Slider>
                </StackPanel>
            </StackPanel>

        </Grid>
       
    </Grid>
    
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo x:Name="taskbarItem" ProgressState="Normal" >
            <TaskbarItemInfo.ThumbButtonInfos >
                <ThumbButtonInfo ImageSource="Stop.png" Click="ThumbButtonInfo_Stop_Click"></ThumbButtonInfo>
                <ThumbButtonInfo ImageSource="Play.png" Click="ThumbButtonInfo_Play_Click"></ThumbButtonInfo>
                <ThumbButtonInfo ImageSource="Pause.png" Click="ThumbButtonInfo_Pause_Click"></ThumbButtonInfo>
            </TaskbarItemInfo.ThumbButtonInfos>
           
            
        </TaskbarItemInfo>
    </Window.TaskbarItemInfo>
</Window>
